package com.ethink.warehouse.converter;

import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Component;
import com.ethink.framework.common.converter.Converter;
import com.ethink.warehouse.api.info.MateInventorySaleChannelChangeLogDetailInfo;
import com.ethink.warehouse.common.entity.MateInventorySaleChannelChangeLogDetail;

/**
 * 库存货权变更明细 Converter转换器
 *
 * @author default
 * @date 2023-01-06
 */
@Component
public class MateInventorySaleChannelChangeLogDetailConverter implements Converter<MateInventorySaleChannelChangeLogDetailInfo, MateInventorySaleChannelChangeLogDetail> {

    @Override
    public MateInventorySaleChannelChangeLogDetail convertTo(MateInventorySaleChannelChangeLogDetailInfo info) {
        if(info == null) {
            return null;
        }
        MateInventorySaleChannelChangeLogDetail entity = new MateInventorySaleChannelChangeLogDetail ();
        BeanUtils.copyProperties(info, entity);
        return entity;
    }

    @Override
    public MateInventorySaleChannelChangeLogDetailInfo convertFrom(MateInventorySaleChannelChangeLogDetail entity) {
        if(entity == null) {
            return null;
        }
        MateInventorySaleChannelChangeLogDetailInfo info = new MateInventorySaleChannelChangeLogDetailInfo();
        BeanUtils.copyProperties(entity, info);
        return info;
    }
}
